﻿function getRootPath() {
    return "${sysPath}";
}
function makeGridButton(buttons) {
    var html = '';
    if (buttons && buttons.length > 0) {
        for (var i = 0; i < buttons.length; i++) {
            var button = buttons[i];
            html+='<a href="javascript:void(0);" class="btn-icon" onclick="' + button.click + '" title="' + button.text + '"><i class="' + button.iconClass + '"></i>' + '</a>';
        }
    }
    return html;
}

function showReturnButton(returnUrl) {
    var panel = mini.get("main-panel");

    var buttons = [
        {
            click: "javascript:returnButtonClick('" + returnUrl +"')",
            iconClass: 'icon_extend_return',
            text: '返回'
        }
    ];
    var html = makeGridButton(buttons);
    if (panel) {
        panel.setButtons([{html: html}]);
    }
}

function hideAllReturnButton() {
    var panel = mini.get("main-panel");
    if (panel) {
        panel.setButtons([{ html: "" }]);
    }
}

function returnButtonClick(returnUrl) {
    var panel = mini.get("main-panel");
    if (returnUrl) {
        if (panel) {
            panel.setUrl(returnUrl);
        }
    }
}
